﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FacultyExample
{
    class Faculty
    {
        public string Name;
        public List<Chair> chairs = new List<Chair>();

        public static int facultyCount;

        public static Faculty GenerateRandomFaculty()
        {
            Faculty.facultyCount++;
            Faculty faculty = new Faculty();
            faculty.Name = "Faculty of Univercity " + facultyCount++;
            for (int i = 0; i < 3; i++)
            {
                Chair chr = Chair.GenerateRandomChair();
                faculty.chairs.Add(chr);
            }
            return faculty;
        }

        public void GenerateFaculty()
        {
            facultyCount++;
            Name = facultyCount.ToString();
           
        }

        public void PrintStudentsWithAverageMark(double averageMark)
        {
            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++");
            Console.WriteLine("Faculty Name: {0}", Name);
            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++");
            foreach (Chair chair in chairs)
            {
                chair.PrintStudentsWithAverageMark(averageMark);
            }
            Console.WriteLine("================");
        }

        public void PrintFacultyToConsole()
        {
            Console.WriteLine("-------------------------------------");
            Console.WriteLine("Faculty Name: {0}", Name);
            Console.WriteLine("-------------------------------------");
            Console.WriteLine();
            foreach (var chair in chairs)
            {
                chair.PrintChairToConsole();
            }
        }

        public void PrintStudentsOfFacultyWithHighAveMarkToConsole()
        {
            Console.WriteLine("-------------------------------------");
            Console.WriteLine("Faculty Name: {0}", Name);
            Console.WriteLine("-------------------------------------");
            Console.WriteLine();
            foreach (var chair in chairs)
            {
                Student student = new Student();
                student.GenerateRandomStudentParameters();
                if (student.CalculateAvgMark() > 50)
                {
                    student.PrintStudentInfoToConsole();
                    student.PrintStudentMarksToConsole();
                }
                Console.WriteLine("--------------");

            }
        }

    }
}
